.\"
.\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
.\" permission to reproduce portions of its copyrighted documentation.
.\" Original documentation from The Open Group can be obtained online at
.\" http://www.opengroup.org/bookstore/.
.\"
.\" The Institute of Electrical and Electronics Engineers and The Open
.\" Group, have given us permission to reprint portions of their
.\" documentation.
.\"
.\" In the following statement, the phrase ``this text'' refers to portions
.\" of the system documentation.
.\"
.\" Portions of this text are reprinted and reproduced in electronic form
.\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
.\" Standard for Information Technology -- Portable Operating System
.\" Interface (POSIX), The Open Group Base Specifications Issue 6,
.\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
.\" Engineers, Inc and The Open Group.  In the event of any discrepancy
.\" between these versions and the original IEEE and The Open Group
.\" Standard, the original IEEE and The Open Group Standard is the referee
.\" document.  The original Standard can be obtained online at
.\" http://www.opengroup.org/unix/online.html.
.\"
.\" This notice shall appear on any product containing this material.
.\"
.\" The contents of this file are subject to the terms of the
.\" Common Development and Distribution License (the "License").
.\" You may not use this file except in compliance with the License.
.\"
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
.\" or http://www.opensolaris.org/os/licensing.
.\" See the License for the specific language governing permissions
.\" and limitations under the License.
.\"
.\" When distributing Covered Code, include this CDDL HEADER in each
.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
.\" If applicable, add the following below this CDDL HEADER, with the
.\" fields enclosed by brackets "[]" replaced with your own identifying
.\" information: Portions Copyright [yyyy] [name of copyright owner]
.\"
.\"
.\" Copyright (c) 2001, The IEEE and The Open Group.  All Rights Reserved.
.\" Portions Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved.
.\"
.TH TERMIOS.H 3HEAD "September 22, 2020"
.SH NAME
termios.h, termios \- define values for termios
.SH SYNOPSIS
.nf
#include <\fBtermios.h\fR>
.fi

.SH DESCRIPTION
The <\fBtermios.h\fR> header contains the definitions used by the terminal I/O
interfaces. See \fBtermios\fR(3C) and \fBtermio\fR(4I) for an overview of the
terminal interface.
.SS "The termios Structure"
The following data types are defined through \fBtypedef\fR:
.sp
.ne 2
.na
\fB\fBcc_t\fR\fR
.ad
.RS 12n
used for terminal special characters
.RE

.sp
.ne 2
.na
\fB\fBspeed_t\fR\fR
.ad
.RS 12n
used for terminal baud rates
.RE

.sp
.ne 2
.na
\fB\fBtcflag_t\fR\fR
.ad
.RS 12n
used for terminal modes
.RE

.sp
.LP
The above types are all unsigned integer types.
.sp
.LP
The implementation supports one or more programming environments in which the
widths of \fBcc_t\fR, \fBspeed_t\fR, and \fBtcflag_t\fR are no greater than the
width of type \fBlong\fR. The names of these programming environments can be
obtained using the \fBconfstr\fR(3C) function or the \fBgetconf\fR(1) utility.
.sp
.LP
The \fBtermios\fR structure is defined and includes the following members:
.sp
.in +2
.nf
tcflag_t c_iflag        /* input modes */
tcflag_t c_oflag        /* output modes */
tcflag_t c_cflag        /* control modes */
tcflag_t c_lflag        /* local modes */
cc_t     c_cc[NCCS]     /* control characters */
.fi
.in -2

.sp
.LP
A definition is provided for:
.sp
.ne 2
.na
\fB\fBNCCS\fR\fR
.ad
.RS 8n
size of the array \fBc_cc\fR for control characters
.RE

.sp
.LP
The following subscript names for the array \fBc_cc\fR are defined:
.sp

.sp
.TS
c c c
l l l .
Subscript Usage	Subscript Usage	Description
Canonical Mode	Non-Canonical Mode
_
\fBVEOF\fR		EOF character
\fBVEOL\fR		EOL character
\fBVERASE\fR		ERASE character
\fBVERASE2\fR		ERASE2 character
\fBVINTR\fR	\fBVINTR\fR	INTR character
\fBVKILL\fR		KILL character
	\fBVMIN\fR	MIN value
\fBVQUIT\fR	\fBVQUIT\fR	QUIT character
\fBVSTART\fR	\fBVSTART\fR	START character
\fBVSTOP\fR	\fBVSTOP\fR	STOP character
\fBVSUSP\fR	\fBVSUSP\fR	SUSP character
	\fBVTIME\fR	TIME value
\fBVSTATUS\fR		STATUS character
.TE

.sp
.LP
The subscript values are unique, except that the \fBVMIN\fR and \fBVTIME\fR
subscripts can have the same values as the \fBVEOF\fR and \fBVEOL\fR
subscripts, respectively.
.sp
.LP
The header file provides the flags described below.
.SS "Input Modes"
The \fBc_iflag\fR field describes the basic terminal input control:
.sp
.ne 2
.na
\fB\fBBRKINT\fR\fR
.ad
.RS 10n
Signal interrupt on break.
.RE

.sp
.ne 2
.na
\fB\fBICRNL\fR\fR
.ad
.RS 10n
Map CR to NL on input.
.RE

.sp
.ne 2
.na
\fB\fBIGNBRK\fR\fR
.ad
.RS 10n
Ignore break condition.
.RE

.sp
.ne 2
.na
\fB\fBIGNCR\fR\fR
.ad
.RS 10n
Ignore CR.
.RE

.sp
.ne 2
.na
\fB\fBIGNPAR\fR\fR
.ad
.RS 10n
Ignore characters with parity errors.
.RE

.sp
.ne 2
.na
\fB\fBINLCR\fR\fR
.ad
.RS 10n
Map NL to CR on input.
.RE

.sp
.ne 2
.na
\fB\fBINPCK\fR\fR
.ad
.RS 10n
Enable input parity check.
.RE

.sp
.ne 2
.na
\fB\fBISTRIP\fR\fR
.ad
.RS 10n
Strip character.
.RE

.sp
.ne 2
.na
\fB\fBIXANY\fR\fR
.ad
.RS 10n
Enable any character to restart output.
.RE

.sp
.ne 2
.na
\fB\fBIXOFF\fR\fR
.ad
.RS 10n
Enable start/stop input control.
.RE

.sp
.ne 2
.na
\fB\fBIXON\fR\fR
.ad
.RS 10n
Enable start/stop output control.
.RE

.sp
.ne 2
.na
\fB\fBPARMRK\fR\fR
.ad
.RS 10n
Mark parity errors.
.RE

.SS "Output Modes"
The \fBc_oflag\fR field specifies the system treatment of output:
.sp
.ne 2
.na
\fB\fBOPOST\fR\fR
.ad
.RS 10n
Post-process output.
.RE

.sp
.ne 2
.na
\fB\fBONLCR\fR\fR
.ad
.RS 10n
Map NL to CR-NL on output.
.RE

.sp
.ne 2
.na
\fB\fBOCRNL\fR\fR
.ad
.RS 10n
Map CR to NL on output.
.RE

.sp
.ne 2
.na
\fB\fBONOCR\fR\fR
.ad
.RS 10n
No CR output at column 0.
.RE

.sp
.ne 2
.na
\fB\fBONLRET\fR\fR
.ad
.RS 10n
NL performs CR function.
.RE

.sp
.ne 2
.na
\fB\fBOFILL\fR\fR
.ad
.RS 10n
Use fill characters for delay.
.RE

.sp
.ne 2
.na
\fB\fBNLDLY\fR\fR
.ad
.RS 10n
Select newline delays:
.sp
.ne 2
.na
\fB\fBNL0\fR\fR
.ad
.RS 7n
newline type 0
.RE

.sp
.ne 2
.na
\fB\fBNL1\fR\fR
.ad
.RS 7n
newline type 1
.RE

.RE

.sp
.ne 2
.na
\fB\fBCRDLY\fR\fR
.ad
.RS 10n
Select carriage-return delays:
.sp
.ne 2
.na
\fB\fBCR0\fR\fR
.ad
.RS 7n
carriage-return delay type 0
.RE

.sp
.ne 2
.na
\fB\fBCR1\fR\fR
.ad
.RS 7n
carriage-return delay type 1
.RE

.sp
.ne 2
.na
\fB\fBCR2\fR\fR
.ad
.RS 7n
carriage-return delay type 2
.RE

.sp
.ne 2
.na
\fB\fBCR3\fR\fR
.ad
.RS 7n
carriage-return delay type 3
.RE

.RE

.sp
.ne 2
.na
\fB\fBTABDLY\fR\fR
.ad
.RS 10n
Select horizontal-tab delays:
.sp
.ne 2
.na
\fB\fBTAB0\fR\fR
.ad
.RS 8n
horizontal-tab delay type 0
.RE

.sp
.ne 2
.na
\fB\fBTAB1\fR\fR
.ad
.RS 8n
horizontal-tab delay type 1
.RE

.sp
.ne 2
.na
\fB\fBTAB2\fR\fR
.ad
.RS 8n
horizontal-tab delay type 2
.RE

.sp
.ne 2
.na
\fB\fBTAB3\fR\fR
.ad
.RS 8n
expand tabs to spaces
.RE

.RE

.sp
.ne 2
.na
\fB\fBBSDLY\fR\fR
.ad
.RS 10n
Select backspace delays:
.sp
.ne 2
.na
\fB\fBBS0\fR\fR
.ad
.RS 7n
backspace-delay type 0
.RE

.sp
.ne 2
.na
\fB\fBBS1\fR\fR
.ad
.RS 7n
backspace-delay type 1
.RE

.RE

.sp
.ne 2
.na
\fB\fBVTDLY\fR\fR
.ad
.RS 10n
Select vertical-tab delays:
.sp
.ne 2
.na
\fB\fBVT0\fR\fR
.ad
.RS 7n
vertical-tab delay type 0
.RE

.sp
.ne 2
.na
\fB\fBVT1\fR\fR
.ad
.RS 7n
vertical-tab delay type 1
.RE

.RE

.sp
.ne 2
.na
\fB\fBFFDLY\fR\fR
.ad
.RS 10n
Select form-feed delays:
.sp
.ne 2
.na
\fB\fBFF0\fR\fR
.ad
.RS 7n
form-feed delay type 0
.RE

.sp
.ne 2
.na
\fB\fBFF1\fR\fR
.ad
.RS 7n
form-feed delay type 1
.RE

.RE

.SS "Baud Rate Selection"
The input and output baud rates are stored in the \fBtermios\fR structure.
These are the valid values for objects of type \fBspeed_t\fR. The following
values are defined, but not all baud rates need be supported by the underlying
hardware.
.sp
.ne 2
.na
\fB\fBB0\fR\fR
.ad
.RS 10n
Hang up
.RE

.sp
.ne 2
.na
\fB\fBB50\fR\fR
.ad
.RS 10n
50 baud
.RE

.sp
.ne 2
.na
\fB\fBB75\fR\fR
.ad
.RS 10n
75 baud
.RE

.sp
.ne 2
.na
\fB\fBB110\fR\fR
.ad
.RS 10n
110 baud
.RE

.sp
.ne 2
.na
\fB\fBB134\fR\fR
.ad
.RS 10n
134.5 baud
.RE

.sp
.ne 2
.na
\fB\fBB150\fR\fR
.ad
.RS 10n
150 baud
.RE

.sp
.ne 2
.na
\fB\fBB200\fR\fR
.ad
.RS 10n
200 baud
.RE

.sp
.ne 2
.na
\fB\fBB300\fR\fR
.ad
.RS 10n
300 baud
.RE

.sp
.ne 2
.na
\fB\fBB600\fR\fR
.ad
.RS 10n
600 baud
.RE

.sp
.ne 2
.na
\fB\fBB1200\fR\fR
.ad
.RS 10n
1 200 baud
.RE

.sp
.ne 2
.na
\fB\fBB1800\fR\fR
.ad
.RS 10n
1 800 baud
.RE

.sp
.ne 2
.na
\fB\fBB2400\fR\fR
.ad
.RS 10n
2 400 baud
.RE

.sp
.ne 2
.na
\fB\fBB4800\fR\fR
.ad
.RS 10n
4 800 baud
.RE

.sp
.ne 2
.na
\fB\fBB9600\fR\fR
.ad
.RS 10n
9 600 baud
.RE

.sp
.ne 2
.na
\fB\fBB19200\fR\fR
.ad
.RS 10n
19 200 baud
.RE

.sp
.ne 2
.na
\fB\fBB38400\fR\fR
.ad
.RS 10n
38 400 baud
.RE

.SS "Control Modes"
The \fBc_cflag\fR field describes the hardware control of the terminal; not all
values specified are required to be supported by the underlying hardware:
.sp
.ne 2
.na
\fB\fBCSIZE\fR\fR
.ad
.RS 10n
Character size:
.sp
.ne 2
.na
\fB\fBCS5\fR\fR
.ad
.RS 7n
5 bits
.RE

.sp
.ne 2
.na
\fB\fBCS6\fR\fR
.ad
.RS 7n
6 bits
.RE

.sp
.ne 2
.na
\fB\fBCS7\fR\fR
.ad
.RS 7n
7 bits
.RE

.sp
.ne 2
.na
\fB\fBCS8\fR\fR
.ad
.RS 7n
8 bits
.RE

.RE

.sp
.ne 2
.na
\fB\fBCSTOPB\fR\fR
.ad
.RS 10n
Send two stop bits, else one.
.RE

.sp
.ne 2
.na
\fB\fBCREAD\fR\fR
.ad
.RS 10n
Enable receiver.
.RE

.sp
.ne 2
.na
\fB\fBPARENB\fR\fR
.ad
.RS 10n
Parity enable.
.RE

.sp
.ne 2
.na
\fB\fBPARODD\fR\fR
.ad
.RS 10n
Odd parity, else even.
.RE

.sp
.ne 2
.na
\fB\fBHUPCL\fR\fR
.ad
.RS 10n
Hang up on last close.
.RE

.sp
.ne 2
.na
\fB\fBCLOCAL\fR\fR
.ad
.RS 10n
Ignore modem status lines.
.RE

.sp
.LP
The implementation supports the functionality associated with the symbols
\fBCS7\fR, \fBCS8\fR, \fBCSTOPB\fR, \fBPARODD\fR, and \fBPARENB\fR.
.SS "Local Modes"
The \fBc_lflag\fR field of the argument structure is used to control various
terminal functions:
.sp
.ne 2
.na
\fB\fBECHO\fR\fR
.ad
.RS 10n
Enable echo.
.RE

.sp
.ne 2
.na
\fB\fBECHOE\fR\fR
.ad
.RS 10n
Echo erase character as error-correcting backspace.
.RE

.sp
.ne 2
.na
\fB\fBECHOK\fR\fR
.ad
.RS 10n
Echo KILL.
.RE

.sp
.ne 2
.na
\fB\fBECHONL\fR\fR
.ad
.RS 10n
Echo NL.
.RE

.sp
.ne 2
.na
\fB\fBICANON\fR\fR
.ad
.RS 10n
Canonical input (erase and kill processing).
.RE

.sp
.ne 2
.na
\fB\fBIEXTEN\fR\fR
.ad
.RS 10n
Enable extended input character processing.
.RE

.sp
.ne 2
.na
\fB\fBISIG\fR\fR
.ad
.RS 10n
Enable signals.
.RE

.sp
.ne 2
.na
\fB\fBNOFLSH\fR\fR
.ad
.RS 10n
Disable flush after interrupt or quit.
.RE

.sp
.ne 2
.na
\fB\fBTOSTOP\fR\fR
.ad
.RS 10n
Send \fBSIGTTOU\fR for background output.
.RE

.SS "Attribute Selection"
The following symbolic constants for use with \fBtcsetattr()\fR are defined:
.sp
.ne 2
.na
\fB\fBTCSANOW\fR\fR
.ad
.RS 13n
Change attributes immediately.
.RE

.sp
.ne 2
.na
\fB\fBTCSADRAIN\fR\fR
.ad
.RS 13n
Change attributes when output has drained.
.RE

.sp
.ne 2
.na
\fB\fBTCSAFLUSH\fR\fR
.ad
.RS 13n
Change attributes when output has drained; also flush pending input.
.RE

.SS "Line Control"
The following symbolic constants for use with \fBtcflush()\fR are defined:
.sp
.ne 2
.na
\fB\fBTCIFLUSH\fR\fR
.ad
.RS 13n
Flush pending input.
.RE

.sp
.ne 2
.na
\fB\fBTCIOFLUSH\fR\fR
.ad
.RS 13n
Flush both pending input and untransmitted output.
.RE

.sp
.ne 2
.na
\fB\fBTCOFLUSH\fR\fR
.ad
.RS 13n
Flush untransmitted output.
.RE

.sp
.LP
The following symbolic constants for use with \fBtcflow()\fR are defined:
.sp
.ne 2
.na
\fB\fBTCIOFF\fR\fR
.ad
.RS 10n
Transmit a \fBSTOP\fR character, intended to suspend input data.
.RE

.sp
.ne 2
.na
\fB\fBTCION\fR\fR
.ad
.RS 10n
Transmit a \fBSTART\fR character, intended to restart input data.
.RE

.sp
.ne 2
.na
\fB\fBTCOOFF\fR\fR
.ad
.RS 10n
Suspend output.
.RE

.sp
.ne 2
.na
\fB\fBTCOON\fR\fR
.ad
.RS 10n
Restart output.
.RE

.SH ATTRIBUTES
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Standard
.TE

.SH SEE ALSO
.BR getconf (1),
.BR cfgetispeed (3C),
.BR cfsetispeed (3C),
.BR confstr (3C),
.BR tcdrain (3C),
.BR tcflow (3C),
.BR tcflush (3C),
.BR tcgetattr (3C),
.BR tcgetsid (3C),
.BR tcsendbreak (3C),
.BR tcsetattr (3C),
.BR attributes (7),
.BR standards (7)
